/*
 * @Description: 督办设置
 */
import globalMethods from '@/plugins/methods';
import SuperviseSetting from './index.vue';

//打开督办设置弹窗
export function supervise(resolve=()=>{}) {
  let ctx = null;
  this.$confirm({
    title: $.i18n('collaboration.nodePerm.superviseOperation.label'),
    icon:(h)=>'',
    // h 参数需保留，渲染需要该参数
    // eslint-disable-next-line no-unused-vars
    content: h => <SuperviseSetting onGetContext={(v) => (ctx = v)} />,
    cancelText: globalMethods.i18n('common.button.cancel.label'),
    okText: globalMethods.i18n('common.button.ok.label'),
    onOk() {
      ctx.confirm();
      resolve(true);
    },
    onClose: () => resolve(),
    onCancel: () => resolve(),
    class: 'supervise-setting-confirm-container',
  });
}

export default function () {
  return new Promise((resolve) => {
    supervise.call(this);
    resolve();
  });
}
